
<%@ page import="pojo.Tcm" %>
<%@ page import="java.util.List" %>
<%@ page import="dto.TcmDetailDto" %>
<%@ page import="pojo.ClassicFormula" %>
<%@ page import="util.PageUtil" %><%--
  Created by IntelliJ IDEA.
  User: 13615
  Date: 2021/9/9
  Time: 14:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>中药模块</title>
</head>
<script>
    function SearchByName(){
        var key=document.getElementById("name").value;
        location.href="/TcmSystem/CFServlet?action=search&flag=0&key="+key;
    }
    function SearchByAlias(){
        var key=document.getElementById("alias").value;
        location.href="/TcmSystem/CFServlet?action=search&flag=1&key="+key;
    }
    function SearchByTcmName(){
        var key=document.getElementById("tcmName").value;
        location.href="/TcmSystem/CFServlet?action=search&flag=2&key="+key;
    }
</script>
<body>
<%
    PageUtil pu=(PageUtil)request.getAttribute("cFList");
    List<ClassicFormula> cFList=pu.getList();
    int curPage=(int)request.getAttribute("curPage");
%>

<h1 align="center">经方查询</h1>
<div align="center">
    <form action="#" method="post">
    <table>
        <tr>
            <td>
                名称查询:
                <input type="text" id="name" name="name"/>
                <input type="button" value="查询" onclick="SearchByName();">
            </td>
            <td>
                别名查询:
                <input type="text" id="alias" name="alias"/>
                <input type="button" value="查询" onclick="SearchByAlias();">
            </td>
            <td>
                中药名查询:
                <input type="text" id="tcmName" name="tcmName"/>
                <input type="button" value="查询" onclick="SearchByTcmName();">
            </td>
        </tr>
    </table>
    </form>
</div>

<table border="2" width="500px" align="center">
    <tr>
        <td>经方名称</td>
        <td>别名</td>
        <td>用法</td>
        <td>注释</td>
        <td>操作</td>
    </tr>
    <%
        for(ClassicFormula cf:cFList){	%>
    <tr>
        <td><%=cf.getName() %> </td>
        <td><%=cf.getAlias()   %> </td>
        <td><%=cf.getUsage()    %> </td>
        <td><%=cf.getComment()    %> </td>
        <td>
            <a href="/TcmSystem/CFServlet?action=detail&id=<%=cf.getId()%>">查看详情</a>&nbsp;
            <a href="#">编辑</a>&nbsp;
            <a href="#">删除</a>
        </td>
    </tr>
    <%} %>
</table>

<div align="center">
    第<%=curPage%>页
</div>
<div align="center">
    <a href="/TcmSystem/CFServlet?action=list&curPage=<%=pu.getPrev()%>">上一页</a>
    <a href="/TcmSystem/CFServlet?action=list&curPage=<%=pu.getNext()%>">下一页</a>
</div>


<div align="center">
    <a href="#">添加中药信息</a>
    <a href="/TcmSystem/index.jsp">返回首页</a>
</div>
<br/>

</body>
</html>
